package security.pojo;

import lombok.Data;

import javax.persistence.*;
import java.util.Objects;

/**
 * @author cyt
 * @create 2020-07-17 16:36
 */
@Data
@Entity
@Table(name = "t_permission", schema = "security", catalog = "")
public class TPermissionEntity {
    private long id;
    private String code;
    private String description;
    private String url;

    @Id
    @Column(name = "id", nullable = false, length = 32)
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    @Basic
    @Column(name = "code", nullable = false, length = 32)
    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Basic
    @Column(name = "description", nullable = true, length = 64)
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @Basic
    @Column(name = "url", nullable = true, length = 128)
    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        TPermissionEntity that = (TPermissionEntity) o;
        return Objects.equals(id, that.id) &&
                Objects.equals(code, that.code) &&
                Objects.equals(description, that.description) &&
                Objects.equals(url, that.url);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, code, description, url);
    }
}
